#include "SDES.hpp"

// 生成子密钥
// P10 35274,10,1986
// P8 637485,10,9
// P4 2431

int main()
{
    std::string key = "1010000010";
    std::string content;
    // std::cin >> content;
    for (size_t pos = 0; pos < 10000000; ++pos)
    {
        printf("\r%zd", pos);
        content += (char)(rand() % 127 + 1);
    }
    printf("\n10000000字符装填完成, 开始运行\n");
    int begin = clock();
    std::string str = SDES(content, key, ENCODE_MODE);

    int end = clock();
    std::cout << "默认加密密钥: " << key << std::endl;
    std::cout << "加密用时: " << (end - begin) / 1000.00 << "毫秒" << std::endl;

    // std::cout << "加密后: " << str << "\n加密用时: " << (end - begin) << "毫秒" << std::endl;
    begin = clock();
    str = SDES(str, key, DECODE_MODE);
    end = clock();
    // std::cout << "解密后: " << str << "\n解密用时: " << (end - begin) << "毫秒" << std::endl;
    std::cout << "解密用时: " << (end - begin) / 1000.00 << "毫秒" << std::endl;
    return 0;
}